﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LiaisonDonnees
{
    public partial class Fm_serviceEmploye : Form
    {
        Donnees bd;
        public Fm_serviceEmploye(Donnees p_bd)
        {
            InitializeComponent();
            bd = p_bd;
            bs.DataSource = bd.ObtServices();
            cb_sexe.Items.Add('F');
            cb_sexe.Items.Add('M');
        }
        private void bs_CurrentChanged(object sender, EventArgs e)
        {

        }
        private void bn_RefreshItems(object sender, EventArgs e)
        {

        }
        private void Fm_serviceEmploye_FormClosing(object sender, FormClosingEventArgs e)
        {
            bs.EndEdit();
            lesEmployesDataGridView.EndEdit();
        }
        private void bs_AddingNew(object sender, AddingNewEventArgs e)
        {
            Employe leEmploye = new Employe();
            e.NewObject = leEmploye;
            bd.ObtEmployes().Add(leEmploye);
            leEmploye.LeService = (Service)bs.Current;
        }
        private void serviceBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            lesEmployesDataGridView.EndEdit();
            bs_employes.EndEdit();
            bs.EndEdit();
            bd.Sauver();
        }
    }
}
